import { AnyAction } from 'redux';
import { ActionType } from '../actions/count';

type State = {
    count: number;
};

const initialState: State = {
    count: 1,
};

export default (state = initialState, action: AnyAction) => {
    switch (action.type) {
        case ActionType.ADD_COUNT: {
            return { ...state, count: state.count + 1 };
        }
        default:
            return state;
    }
};
